package com.example.huichaoliu;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.huichaoliu.app.R;
import com.rederxu.farmer.BaseActivity;

public class LogisticsActivity extends BaseActivity implements OnClickListener {

	private ListView listView = null;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_logistics);
		super.onCreate(savedInstanceState);
	}

	@Override
	public void onClick(View v) {
		switch(v.getId()){
		case R.id.left_button:
			finish();
			break;
		}
	}

	@Override
	public void init() {
		((TextView) findViewById(R.id.title_text)).setText("查看物流");
		findViewById(R.id.left_button).setOnClickListener(this);
		
		listView = (ListView) findViewById(R.id.listView);
	}

	@Override
	public void initData() {
		listView.setAdapter(new Adapter());
	}

	@Override
	public void onNetworkChanged(boolean isMobNetConnected,
			boolean isWifiConnected) {
		// TODO Auto-generated method stub

	}

	private class Adapter extends BaseAdapter{

		@Override
		public int getCount() {
			// TODO Auto-generated method stub
			return 10;
		}

		@Override
		public Object getItem(int position) {
			// TODO Auto-generated method stub
			return null;
		}

		@Override
		public long getItemId(int position) {
			// TODO Auto-generated method stub
			return 0;
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			if(convertView == null){
				convertView = LayoutInflater.from(mContext).inflate(R.layout.item_logisitics, null);
			}
			ImageView ic_mark = (ImageView) convertView.findViewById(R.id.ic_mark);
			TextView tv_content = (TextView) convertView.findViewById(R.id.tv_content);
			TextView tv_time = (TextView) convertView.findViewById(R.id.tv_time);
			if(position == 0){
				ic_mark.setImageResource(R.drawable.ic_round_orange);
				tv_content.setTextColor(0xffFF7800);
				tv_time.setTextColor(0xffFF7800);
			}else{
				ic_mark.setImageResource(R.drawable.ic_round_grey);
				tv_content.setTextColor(0xff747474);
				tv_time.setTextColor(0xff747474);
			}
			return convertView;
		}
	}
}
